package com.dao.impl;

import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.dao.StudentDao;
import com.eneity.student;
import com.until.AliPool;


public class StudentDaoimpl implements StudentDao{
	Connection conn;
	PreparedStatement pst;


	@Override
	public List<student> findAll() throws SQLException {
		List<student> list = new ArrayList<student>();
		String sql = "select * from studentt";
		conn =AliPool.getConn();
		pst = conn.prepareStatement(sql);
		ResultSet rs = pst.executeQuery();
		while(rs.next()) {
			String stuno=rs.getString(1);
			String name = rs.getString(2);
			String sex = rs.getString(3);
			String age = rs.getString(4);
			String branches = rs.getString(5);
			student cl = new student(stuno,name,sex,age,branches);
			list.add(cl);
		}
		conn.close();
		return list;
	}
}
